package com.bw.router

import android.content.Context
import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.facade.service.DegradeService
import com.alibaba.android.arouter.launcher.ARouter
import com.bw.common.path.RouthPath

/**
 * 全局的降级策略
 */
@Route(path = RouthPath.PATH_GLOBAL_DEGRADE)

class GlobalDegradeService:DegradeService{
    private lateinit var mContext:Context
    override fun init(context: Context) {
        mContext=context
    }

    override fun onLost(context: Context, postcard: Postcard) {
        postcard.group = RouthPath.GROUP_EMPTY//必须重新指定group参数
        postcard.path=RouthPath.PATH_EMPTY_PAGE//当页面找不到，设置空的页面
        postcard.navigation()
//        ARouter.getInstance().build(postcard.path).navigation()
    }

}